Public Class SQLData
    Public Function Load_query(ByVal server As String, ByVal user As String, ByVal password As String, ByVal dataname As String, ByVal SQL As String) As DataSet
        Dim datas As New DataSet
        'Server=perfectserver; user=sa; password=23212; database=workstation
        'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Northwind.mdb
        datas = New System.Data.DataSet
        Dim connection As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection("Server=" & server & "; user=" & user & "; password=" & password & "; database=" & dataname)
        Dim adapter As System.Data.SqlClient.SqlDataAdapter = New System.Data.SqlClient.SqlDataAdapter(SQL, connection)
        Dim table As System.Data.DataTable = New System.Data.DataTable("C")
        adapter.Fill(table)
        datas.Tables.Add(table)
        Return datas
    End Function
    Public Function Change_query(ByVal server As String, ByVal user As String, ByVal password As String, ByVal dataname As String, ByVal SQL As String) As String
        On Error GoTo err
        Dim Status As String
        Dim connection As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection("Server=" & server & "; user=" & user & "; password=" & password & "; database=" & dataname)
        Dim command As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand(SQL, connection)
        connection.Open()
        command.ExecuteNonQuery()
        connection.Close()
        Status = "Ok"
        Return Status
        Exit Function
err:
        Status = "Error"
        Return Status
    End Function


    Public Function Load_query(ByVal ConnectionString As String, ByVal SQL As String) As DataSet
        Dim datas As New DataSet
        'Server=perfectserver; user=sa; password=23212; database=workstation
        'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Northwind.mdb
        datas = New System.Data.DataSet
        Dim connection As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection(ConnectionString)
        Dim adapter As System.Data.SqlClient.SqlDataAdapter = New System.Data.SqlClient.SqlDataAdapter(SQL, connection)
        Dim table As System.Data.DataTable = New System.Data.DataTable("C")
        adapter.Fill(table)
        datas.Tables.Add(table)
        Return datas
    End Function


    Public Function Change_query(ByVal ConnectionString As String, ByVal SQL As String) As String
        On Error GoTo err
        Dim Status As String
        Dim connection As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection(ConnectionString)
        Dim command As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand(SQL, connection)
        connection.Open()
        command.ExecuteNonQuery()
        connection.Close()
        Status = "Ok"
        Return Status
        Exit Function
err:
        Status = "Error"
        Return Status
    End Function
End Class
